package com.czk.client;

import com.czk.codec.ObjDecoder;
import com.czk.codec.ObjEncoder;
import com.czk.domain.FileTransferProtocol;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;


/**
 * @Author:ChenZhangKun
 * @Date: 2021/6/1 15:04
 */
public class MyClientInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel channel) throws Exception {
        ChannelPipeline pipeline = channel.pipeline();
        pipeline.addLast(new ObjDecoder(FileTransferProtocol.class));
        pipeline.addLast(new ObjEncoder(FileTransferProtocol.class));
        pipeline.addLast(new MyClientHandler());
    }
}
